# -*- coding:UTF-8 -*-
import time

host = "127.0.0.1"

start_url  = "http://192.168.123.229"

import requests

def im_init(ip,port):
    content = None
    req_times = 0
    while True:
        req_times += 1
        content = requests.get(url=start_url + "/api/imConnect",params={"imIp":ip,"imPort":port})
        if content.status_code == 200 and content.content.decode("utf-8")=="OK":
            return True
        time.sleep(5)
        if req_times>10:
            return False
    



    